|
File: /opt/sage/local/lib/python2.6/site-packages/sage/graphs/graph_database.py
Type: <type ‘type’>
Definition: GraphQuery( [noargspec] )
Docstring:
A query for an instance of GraphDatabase. This class nicely wraps
the SQLQuery class located in sage.databases.database.py to make
the query constraints intuitive and with as many pre-definitions as
possible. (i.e.: since it has to be a GraphDatabase, we already know
the table structure and types; and since it is immutable, we can
treat these as a guarantee).
Note
SQLQuery functions are available for GraphQuery. See
sage.dataabases.database.py for more details.
INPUT:
- graph_db - The GraphDatabase instance to apply
the query to. (If None, then a new instance is created).
- query_dict - A dictionary specifying the query
itGraphQuery. Format is: ‘table_name’: ‘tblname’, ‘display_cols’:
[‘col1’, ‘col2’], ‘expression’:[col, operator, value] If not None,
query_dict will take precedence over all other arguments.
- display_cols - A list of column names (strings)
to display in the result when running or showing a query.
- kwds - The columns of the database are all
keywords. For a database table/column structure dictionary, call
graph_db_info. Keywords accept both single values and lists of
length 2. The list allows the user to specify an expression other
than equality. Valid expressions are strings, and for numeric
values (i.e. Reals and Integers) are: ‘=’,’‘,’‘,’=’,’=’. String
values also accept ‘regexp’ as an expression argument. The only
keyword exception to this format is induced_subgraphs, which
accepts one of the following options: 1.
[‘one_of’,String,...,String] Will search for graphs containing a
subgraph isomorphic to any of the graph6 strings in the list. 2.
[‘all_of’,String,...,String] Will search for graphs containing a
subgraph isomorphic to each of the graph6 strings in the list.
EXAMPLES:
sage: Q = GraphQuery(display_cols=['graph6','num_vertices','degree_sequence'],num_edges=['<=',5],min_degree=1)
sage: Q.number_of()
35
sage: Q.show()
Graph6 Num Vertices Degree Sequence
------------------------------------------------------------
A_ 2 [1, 1]
BW 3 [1, 1, 2]
CK 4 [1, 1, 1, 1]
CF 4 [1, 1, 1, 3]
CL 4 [1, 1, 2, 2]
CN 4 [1, 2, 2, 3]
D_K 5 [1, 1, 1, 1, 2]
D?{ 5 [1, 1, 1, 1, 4]
D@s 5 [1, 1, 1, 2, 3]
DBg 5 [1, 1, 2, 2, 2]
D`K 5 [1, 1, 2, 2, 2]
D@{ 5 [1, 1, 2, 2, 4]
DIk 5 [1, 2, 2, 2, 3]
DBk 5 [1, 1, 2, 3, 3]
DK[ 5 [1, 2, 2, 2, 3]
E@Q? 6 [1, 1, 1, 1, 1, 1]
E_?w 6 [1, 1, 1, 1, 1, 3]
E?N? 6 [1, 1, 1, 1, 2, 2]
E_Cg 6 [1, 1, 1, 1, 2, 2]
E?Bw 6 [1, 1, 1, 1, 1, 5]
E?Fg 6 [1, 1, 1, 1, 2, 4]
E@FG 6 [1, 1, 1, 2, 2, 3]
E?NG 6 [1, 1, 1, 1, 3, 3]
E@N? 6 [1, 1, 2, 2, 2, 2]
E@YO 6 [1, 1, 2, 2, 2, 2]
E@QW 6 [1, 1, 1, 2, 2, 3]
E_Cw 6 [1, 1, 1, 2, 2, 3]
E_Ko 6 [1, 1, 2, 2, 2, 2]
FK??W 7 [1, 1, 1, 1, 1, 1, 2]
F_?@w 7 [1, 1, 1, 1, 1, 1, 4]
F??^? 7 [1, 1, 1, 1, 1, 2, 3]
F_?Hg 7 [1, 1, 1, 1, 1, 2, 3]
F?LCG 7 [1, 1, 1, 1, 2, 2, 2]
F_?XO 7 [1, 1, 1, 1, 2, 2, 2]
FK?GW 7 [1, 1, 1, 1, 2, 2, 2]
|